<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>创建其他用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="{{ url_for('static',filename='layuiadmin/layui/css/layui.css') }}" media="all">
    <link rel="stylesheet" href="{{ url_for('static',filename='layuiadmin/style/admin.css') }}" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">饭店充值</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone"
                                       class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">饭店充值</label>
                            <div class="layui-input-inline">
                                <input type="text" name="other_income" lay-verify="required"
                                       autocomplete="off" class="layui-input" >
                            </div>
                        </div>

{##}
{#                        <div class="layui-form-item">#}
{#                            <label class="layui-form-label">自贸余额</label>#}
{#                            <div class="layui-input-inline">#}
{#                                <input type="text" name="income" lay-verify="required"#}
{#                                       autocomplete="off" id="LAY_password" class="layui-input">#}
{#                            </div>#}
{#                        </div>#}

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="doSubmit">点击确认</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>


<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">饭店消费(输入正数加 输入负数减)</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone"
                                       class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">消费</label>
                            <div class="layui-input-inline">
                                <input type="text" name="other_income" lay-verify="required"
                                       autocomplete="off" class="layui-input" placeholder="输入正数加 输入负数减">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="doSubmit3">点击确认</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>



<script src="{{ url_for('static',filename='layuiadmin/layui/layui.js') }}"></script>
<script>
    layui.config({
        base: '../../static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'set', 'table', 'jquery', 'layer', 'form', 'upload'], function () {

        var $ = layui.jquery;


        layui.form.on("submit(doSubmit)", function (obj) {
            //序列化表单数据
            var data = obj.field;
            console.log(data);
            layer.confirm('您确定要饭店充值吗?', function (index) {
                $.ajax({
                url: '/cms/create_user_other/',
                type: "POST",
                data: data,
                success: function (data) {
                    if (data['code'] == 200) {
                        //关闭弹框
                        //显示提示框
                        layer.msg("成功", {icon: 6});

                        window.location.reload();
                    } else {
                        layer.msg(data['message'], {icon: 5});
                    }
                }
            });
                return false;
            })
        });


        layui.form.on("submit(doSubmit3)", function (obj) {
            //序列化表单数据
            var data = obj.field;
            console.log(data);
            layer.confirm('您确定要饭店消费吗?', function (index) {
                $.ajax({
                url: '/cms/update_other_income/',
                type: "POST",
                data: data,
                success: function (data) {
                    if (data['code'] == 200) {
                        //关闭弹框
                        //显示提示框
                        layer.msg("成功", {icon: 6});

                        window.location.reload();
                    } else {
                        layer.msg(data['message'], {icon: 5});
                    }
                }
            });
                return false;
            })
        });

    });
</script>
</body>
</html>